home *** CD-ROM | disk | FTP | other *** search
Text File | 1998-01-12 | 2.6 KB | 63 lines | [TEXT/ToyS] |
- property kRANoError : 0
- property kRAPortBusy : -7114
- property OpenDialog : {size:[260, 200], style:movable dialog, name:"Open PPP Connection", contents:[¬
- {class:push button, bounds:[190, 170, 250, 190], name:"OK", enabled:[dAnd, 3, 4, 5]}, ¬
- {class:push button, bounds:[110, 170, 170, 190], name:"Cancel"}, ¬
- {class:text field, bounds:[10, 32, 250, 32 + 16], name bounds:¬
- [10, 10, 250, 26], name:"User name:", value:""}, ¬
- {class:password field, bounds:[10, 82, 250, 82 + 16], name bounds:¬
- [10, 60, 250, 76], name:"Password:", value:""}, ¬
- {class:text field, bounds:[10, 132, 250, 132 + 16], name bounds:¬
- [10, 110, 250, 126], name:"Telephone number:", value:""} ¬
- ], timeout after:60}
- property mainDialog : {size:[88, 76], name:"PPP", style:standard palette, default item:0, closeable:true, contents:[¬
- {class:push button, bounds:[2, 2, 32, 22], name:"Open", font:5}, ¬
- {class:push button, bounds:[34, 2, 64, 22], name:"Close", font:5}, ¬
- {class:static text, contents:"", bounds:[30, 26, 88, 76], font:5}, ¬
- {class:static text, contents:"time:
- in:
- out:
- msg:", bounds:[4, 26, 30, 76], font:5}]}
-
- global username, password, telephone
-
- -- a run message is sent to the script application when it is launched.
- on run
- dd install with fonts [null, null, null, null, {size:9, name:"Geneva"}] float above every application with grayscale
- set [oked, canceled, username, password, telephone] to dd auto dialog OpenDialog --with greyscale
- --set [oked, canceled, username, password, telephone] to [false, false, "", "", ""]
- if oked then OpenPPP()
- set d to dd make dialog mainDialog
- try
- repeat
- set stat to PPP status
- get stat's state = "connected" --dd set enabled of item 2 of d to stat's state = "connected"
- dd set enabled of items 1 thru 2 of d to [not result, result]
- tell stat to dd set contents of item 3 of d to (seconds connected as string) & return & bytes in & return & bytes out & return & message
- set i to dd interact with user for max ticks 120
- if i = 1 then
- OpenPPP()
- else if i = 2 then
- if (PPP status)'s state = "connected" then PPP disconnect
- else if i = -1 then
- exit repeat
- end if
- end repeat
- on error
- end try
- dd uninstall
- [oked, canceled, username, password, telephone]
- end run
-
- on OpenPPP()
- try
- if (username ≠ "") then
- PPP connect address telephone user name (username) password (|password|)
- else
- PPP connect address telephone -- guest access
- end if
- on error errmsg number errnum
- if (errnum ≠ kRANoError) and (errnum ≠ kRAPortBusy) then ¬
- display dialog "Error " & errnum & " was encountered when attempting to establish a PPP connection."
- end try
- end OpenPPP